package com.huang;

import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.Executors;

public class ArrayListNotSafeDemo {
    public static void main(String[] args) {

        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");

        for(String element : list) {
            System.out.println(element);
        }


        Vector<Object> vector = new Vector<>();
        vector.add(123);


        CopyOnWriteArrayList<Integer> integers = new CopyOnWriteArrayList<>();
        integers.add(123);

        CopyOnWriteArraySet<Integer> arraySet = new CopyOnWriteArraySet<>();
        arraySet.add(123);

        Executors.newFixedThreadPool(5);

        HashSet<Integer> set = new HashSet<>();
        Iterator<Integer> iterator = set.iterator();
        iterator.hasNext();

        ArrayList<Integer> list1 = new ArrayList<>();
        list1.iterator().hasNext();

    }
}